<?php

namespace App\Http\Resources\School;

use Illuminate\Http\Resources\Json\Resource;

/**
 * Class BookRulePriceResource
 * @package App\Http\Resources\School
 */
class BookRulePriceResource extends Resource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'rule_id' => $this->rule_id,
            'category_id' => $this->category_id,
            'total_price' => $this->total_price,
            'category' => new PriceCategoryResource($this->whenLoaded('category'))
        ];
    }
}
